/**************************************************************************************
*
*	Copyright (C) 2009 - 2012 Brent Andrew O. Chua - See LICENSE.txt for more info.
*		
*	Filename	-	ParameterScalar.h
*
*	Description -	Parameter for holding scalar variables. Scalar variables supported
*					are bool, int, uint, float; All these are 32bites in size.
*
*	Comments	-
*
*	Modification History:
*			Name			   Date					Description
*			MrCodeSushi	-	02/09/2013	-	Creation of this file
**************************************************************************************/
#ifndef _PSX_PARAMETER_SCALAR_H_
#define _PSX_PARAMETER_SCALAR_H_

#include "PulseSTD.h"
#include "IParameter.h"

namespace Pulse
{
	class ParameterScalar : public IParameter
	{
	public:

		ParameterScalar( void );

		ParameterScalar( ParameterScalar &rhs );

		virtual ~ParameterScalar( void );

		virtual void SetData( void *pData );

		virtual void SetData( IParameter *pParam );

		void SetAsRaw( const void *pData ) { PSX_MemCopyPerByte( m_data, pData, sizeof(m_data) ); IncrementChangeValue(); }

		void SetAsBOOL( const BOOL val ) { m_bool = val; IncrementChangeValue(); }

		void SetAsINT( const INT val ) { m_int = val; IncrementChangeValue(); }
		
		void SetAsUINT( const UINT val ) { m_uint = val; IncrementChangeValue(); }
		
		void SetAsFLOAT( const FLOAT val ) { m_float = val; IncrementChangeValue(); }

		void SetToZero( void );

		void * GetData( void ) { return m_data; }

		virtual EParameter::Type GetType( void ) const { return EParameter::SCALAR; }

	private:


		union
		{
			BYTE	m_data[4]; // Data copy/assignments assumes the size of 32 bytes
			BOOL	m_bool;
			INT		m_int;
			UINT	m_uint;
			FLOAT	m_float;
		};
	};
}

#endif /* _PSX_PARAMETER_SCALAR_H_ */